package com.groupseven.backend.mapper;

import com.groupseven.backend.domain.Program.Manager;
import com.groupseven.backend.domain.Program.Program;
import com.groupseven.backend.domain.Program.ProgramApplication;
import com.groupseven.backend.domain.Program.TeamMember;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Map;

/**
 * author hanaue
 */
@Mapper
public interface ProgramMapper {

    /**
     * @Author 王志华
     * 通过项目编号修改项目信息
     * @param program Program类型
     * @return void
     */
    int modifyByProgramNumber(Program program);

    /**
     * @Author 王志华
     * 通过负责人查询项目
     * @param Manager Program中的Manager参数 类型为int
     * @return Program列表
     */
    List<Program> selectByManager(String Manager);

    /**
     * @Author 王志华
     * 通过项目编号（主键）精确查询项目
     * @param program Program类型
     * @return Program类型
     */
    Program selectByProgramNumber(Program program);

    /**
     * @Author 王志华
     * 插入项目 若该项目编号已存在则会修改项目
     * @param program Program类型
     * @return void
     */
    int insertProgramInfo(Program program);
    /**
     * @Author 王志华
     */
    List<Program> selectAllPrograms();
    /**
     * @Author 王志华
     */
    List<ProgramApplication> findAllProgamApplicationInfo();
    /**
     * @Author 王志华
     */
    Manager findManagerByProgramNumber(String ProgramNumber);
    /**
     * @Author 王志华
     */
    List<TeamMember> findTeamMemberByProgramNumber(String ProgramNumber);
    /**
     * @Author 王志华
     */
    int addProgramApplications(ProgramApplication application);
    /**
     * @Author 王志华
     */
    int addManagerForApplication(Manager manager);
    /**
     * @Author 王志华
     */
    int addTeamMemberForApplication(TeamMember member);
    /**
     * @Author 王志华
     */
    String findMaxProgramNumberFromProgramApplication();
    /**
     * @Author 王志华
     */
    int deleteByProgramNumber(String ProgramNumber);

    /**
     * @Author 王志华
     * @param query
     * @return
     */
    int multipleDelete(Map<String,Object> query);

    /**
     * @Author 王志华
     * @return
     */
    List<ProgramApplication> findUnreviewed();

    /**
     * @Author 王志华
     * @return
     */
    List<ProgramApplication> findReviewed();

    /**
     * @Author 王志华
     * @param query
     * @return
     */
    List<Program> FuzzySearchByProgramname(String query);

    /**
     * @Author 王志华
     * @param query
     * @return
     */
    List<Program> FuzzySearchByPhone(String query);

    /**
     * @Author 王志华
     * @param query
     * @return
     */
    List<Program> FuzzySearchByProgramnumber(String query);

    /**
     * @Author 王志华
     * @param query
     * @return
     */
    List<Program> FuzzySearch(String query);

    List<Program> selectMyProgramsForAssessment(String username);

    ///
    int updateProgramApplicationByProgramNumber(String ProgramNumber);
    ProgramApplication findProgramNumberFromProgramApplication(String ProgramNumber);

    int updateManagerForApplication(String ProgramNumber);

    int updateTeamMemberForApplication(String ProgramNumber);

    int deleteProgramApplicationByProgramNumber(String ProgramNumber);

    int deleteManagerForApplication(String ProgramNumber);

    int deleteTeamMemberForApplication(String ProgramNumber);

    List<ProgramApplication> getMyProgramApplications(String Username);

    int passFirstReview(String number);

    int denyFirstReview(String number);

    int passSecondReview(String Number ,String Level);

    int denySecondReview(String Number );

    int passFirstReviewApplication(String number);

    int denyFirstReviewApplication(String number);

    int passSecondReviewApplication(String Number,String Level);

    int denySecondReviewApplication(String Number);
}
